<?php
/**
 * Description of ApiAction
 *
 * @author Alen
 */
class ApiAction extends SoAction {
    
    public function __construct($enableTemplate = false) {
        parent::__construct($enableTemplate);
    }
    
    /**
     * 获取json格式的返回消息
     * @param type $msg
     * @return type
     * @since 1.0 2014-3-22 by sutroon
     */
    protected function get_json_fmt_result($msg){        
        return $msg=='SUCCESS'?'{"success":1}':'{"errorMsg":"'.$msg.'"}';
    }
    
    /**
     * 获取分页条件
     * @return string
     * @since 1.0 2014-3-27 by sutroon
     */
    protected function get_paging_sql(){        
        $pageId=  request_numeric('page');
        $pageSize=  request_numeric('rows');
        if($pageId && $pageSize) {
            $start_index = ($pageId-1)*$pageSize;
            return ' limit '.$start_index.','.$pageSize;
        }
        return '';
    }
}
